SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
GO

-- =============================================
-- Modified:    Jeff Green
-- Create date: 6/7/2011
-- Description:	The procedure returns all of the movies in a customer's queue

-- =============================================

IF EXISTS (SELECT name FROM sysobjects WHERE name = 'mov_getCustomerQueue' AND type = 'P') DROP PROCEDURE mov_getCustomerQueue
GO

CREATE PROCEDURE [dbo].[mov_getCustomerQueue]
	@email varchar(40)
AS
BEGIN
	SELECT q.*
	FROM [dbo].[customer] c
	INNER JOIN [dbo].[cus_queue] q ON c.cus_id = q.cus_id
	WHERE c.cus_email = @email
	ORDER BY q.que_order
END